import http from "./http"
// https://api-hmugo-web.itheima.net/api/public/v1/home/catitems导航
export const catitemsApi=()=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/home/catitems',
        method:'get'
    })
}
//https://api-hmugo-web.itheima.net/api/public/v1/categories商品分类
export const categoriesApi=()=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/categories',
        method:'get'
    })
}
// https://api-hmugo-web.itheima.net/api/public/v1/goods/detail商品详情
export const detailApi=(goods_id)=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/detail',
        method:'get',
        params:{
            goods_id
        }
    })
}
// https://api-hmugo-web.itheima.net/api/public/v1/goods/qsearch商品搜索
export const qsearchApi=(query)=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/qsearch',
        method:'get',
        data:{
            query
        }
    })
}
// http://localhost:12345/api/user/register注册
export const registerApi=(username,password)=>{
    return http({
        url:'http://localhost:12345/api/user/register',
        method:'post',
        data:{
            username,
            password
        }
    })
}
// http://localhost:12345/api/user/login登录
export const loginApi=(username,password)=>{
    return http({
        url:'http://localhost:12345/api/user/login',
        method:'post',
        data:{
            username,
            password
        }
    })
}
// https://api-hmugo-web.itheima.net/api/public/v1/goods/search商品列表搜索
export const searchApi=(query,pagesize,pagenum,cid)=>{
    return http({
        url:'https://api-hmugo-web.itheima.net/api/public/v1/goods/search',
        method:'get',
        params:{
            query,pagesize,pagenum,cid
        }
    })
}
